﻿<UserControl x:Class="SverigesRadio.SverigesRadioApp.WindowsPhoneApplication.Controls.DirektControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"


    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71" FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid x:Name="LayoutRoot">
        <ListBox Margin="0,0,-12,0" ItemsSource="{Binding ParentViewModel.ChannelInformationViewModels}" SelectedItem="{Binding ChannelSelection, Mode=TwoWay}">

            <Custom:Interaction.Triggers>
                <Custom:EventTrigger EventName="SelectionChanged">
                    <GalaSoft_MvvmLight_Command:EventToCommand 
                     x:Name="SelectionChangedEvent" 
                     Command="{Binding SelectionChangedCommand, Mode=OneWay}" 
                     PassEventArgsToCommand="True"/>
                </Custom:EventTrigger>
            </Custom:Interaction.Triggers>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="0,0,0,17">
                        <Rectangle Height="100" Width="50" Fill="{Binding Channel.FormattedColour}" Margin="12,0,9,0"/>
                        <StackPanel Margin="0,0,0,17" Width="Auto" Height="78">
                            <TextBlock Text="{Binding Channel.Name}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                            <TextBlock Text="{Binding CurrentProgramTitle}" TextWrapping="Wrap" Margin="12,-6,12,0"  Style="{StaticResource PhoneTextSubtleStyle}"/>

                        </StackPanel>
                    </StackPanel>
                </DataTemplate>

            </ListBox.ItemTemplate>
            
        </ListBox>
    </Grid>
</UserControl>
